package cc.magicjson.easy.batch.model;

import cc.magicjson.easy.batch.config.BatchSqlProvider;
import cc.magicjson.easy.batch.core.BatchParameterExtractor;
import cc.magicjson.easy.batch.core.BatchProgressCallback;
import cc.magicjson.easy.batch.template.SqlTemplate;
import lombok.Builder;
import lombok.Data;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.transaction.support.TransactionTemplate;

import java.util.List;

/**
 * Batch processing context
 */
@Data
@Builder
public class BatchContext<T> {
    private List<T> items;
    private String sqlKey;
    private BatchParameterExtractor<T> parameterExtractor;
    private boolean useTransaction;
    private int batchSize;
    private boolean allowPartialSuccess;
    private BatchProgressCallback progressCallback;
    private int retryAttempts;
    private long retryDelay;
    private boolean parallel;
    private int threadCount;
    private JdbcTemplate jdbcTemplate;
    private TransactionTemplate transactionTemplate;
    private BatchSqlProvider sqlProvider;
    private SqlTemplate sqlTemplate;
}
